import { commonAttrs } from './commonAttrs'

export const formInputAttrs: any = [
    { key: 'defaultText', group: 'basic', order: 1002, label: '标题', attrValEditor: 'InputAttrValEditor' },
    { key: 'placeholder', group: 'basic', order: 1003, label: '占位文本', attrValEditor: 'InputAttrValEditor' },
]

function merge(...params: any[]) {
    return params.reduce((a, b) => a.concat(b)).sort((a1: any, a2: any) => a1.order - a2.order)
}

export interface AttrDesc {
    group: string
    label: string
    key: string
    attrValEditor?: string
    order: number
    extraOprions?: any
    supDataOpt?: string
    dataType?: string
}
export interface AttrDescGroup {
    name: string
    label: string
    attrDescs?: AttrDesc[]
    hidden?: boolean // 是否在页面展示
}

/** 属性编辑器分组 */
export const ATTR_GROUPS: AttrDescGroup[] = [{ name: 'basic', label: '基本' }]
export default {
    ATTR_GROUPS,
    PAGE_HrMdl: merge(formInputAttrs), // commonAttrs
}
